package exception05;

public class Peron {
    private int age;

    public Peron(int age) throws AgeException{
        if (age < 0) {
            throw new AgeException("年龄不能为负值:" + age);
        }
        this.age = age;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age)throws AgeException {
        if (age < 0) {
            throw new AgeException("年龄不能为负值:" + age);
        }
        this.age = age;
    }
}
